<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Hard
  </div>
  <div>
   <h1 class="question_title">
    407. Trapping Rain Water II
   </h1>
   <p>
    Given an
    <code>
     m x n
    </code>
    matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining.
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <b>
     Note:
    </b>
   </p>
   <p>
    Both
    <i>
     m
    </i>
    and
    <i>
     n
    </i>
    are less than 110. The height of each unit cell is greater than 0 and is less than 20,000.
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <b>
     Example:
    </b>
   </p>
   <pre>
Given the following 3x6 height map:
[
  [1,4,3,1,3,2],
  [3,2,1,3,2,4],
  [2,3,3,2,3,1]
]

Return 4.
</pre>
   <p>
    <img src="https://assets.leetcode.com/uploads/2018/10/13/rainwater_empty.png" style="width: 100%; max-width: 500px;">
   </p>
   <p>
    The above image represents the elevation map
    <code>
     [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]
    </code>
    before the rain.
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <img src="https://assets.leetcode.com/uploads/2018/10/13/rainwater_fill.png" style="width: 100%; max-width: 500px;">
   </p>
   <p>
    After the rain, water is trapped between the blocks. The total volume of water trapped is 4.
   </p>
  </div>
  <div>
   <h1 class="question_title">
    407. 接雨水 II
   </h1>
   <p>
    给定一个
    <code>
     m x n
    </code>
    &nbsp;的矩阵，其中的值均为正整数，代表二维高度图每个单元的高度，请计算图中形状最多能接多少体积的雨水。
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     说明:
    </strong>
   </p>
   <p>
    <em>
     m&nbsp;
    </em>
    和
    <em>
     n&nbsp;
    </em>
    都是小于110的整数。每一个单位的高度都大于0 且小于 20000。
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     示例：
    </strong>
   </p>
   <pre>给出如下 3x6 的高度图:
[
  [1,4,3,1,3,2],
  [3,2,1,3,2,4],
  [2,3,3,2,3,1]
]

返回 4。
</pre>
   <p>
    <img src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/10/12/rainwater_empty.png" style="width: 100%; max-width: 500px;">
   </p>
   <p>
    如上图所示，这是下雨前的高度图
    <code>
     [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]
    </code>
    的状态。
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <img src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/10/12/rainwater_fill.png" style="width: 100%; max-width: 500px;">
   </p>
   <p>
    下雨后，雨水将会被存储在这些方块中。总的接雨水量是4。
   </p>
  </div>
 </body>
</html>